class Solution:
    def myPow(self, x: float, n: int) -> float:
        if n <0:
            n = -n
            x = 1/x
        res = 1
        while n:
            if n & 1:
               res *= x
            x *=x
            n >>= 1
        return res



if __name__ == '__main__':
    x =2.00000
    n = 10
    solution = Solution()
    val = solution.myPow(x,n)
    print(val)